package excption.work;

import java.io.FileOutputStream;
import java.io.IOException;

public class test3 {
    public static void main(String[] args) {
        System.out.println("程序开始了");

        try {
            String line =null;
            System.out.println(line.length());
        } catch (NullPointerException e) {
            System.out.println("空指针异常处理了");
        }

        try {
            String line ="";
            System.out.println(line.charAt(0));
        } catch (StringIndexOutOfBoundsException e) {
            System.out.println("下标越界异常处理了");
        }


        try {
            int line =0;
            int sum=0/line;
            System.out.println(sum);
        } catch (Exception e) {
            System.out.println("错误解决了");
        }


        System.out.println("程序结束了");
    }
}
